<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$cate = $this->widget('Widget_Metas_Category_List');
$l = $this->categories;
$mid = ($this->is('index')) ? '0' : (empty($l) ? 'null' : $l[(count($l) - 1)]['mid']);
?>
<div class="scroller-y" style="height: calc(100vh - 42px);">
    <!-- profile -->
    <div class="-mine">
        <div class="bg-image img-doubao-face"></div>
        <div class="hide-sm text-center mt-1 text-primary text-uppercase">www.doubao.life</div>
        <div class="text-center text-small text-gray my-2"><?php $this->options->description() ?>
        </div>
    </div>

    <!-- archive counter -->
    <div class="columns -counter">
        <div class="column col-12 show-sm text-center">
            <span class="chip text-sec-gray">数据概览</span>
        </div>
        <div class="column col-4 col-sm-12">
            <div class="-info-viewer">
                <div class="text-center">
                    <div class="big-val text-error"><?php echo postCount(); ?></div>
                    <div class=" desc">文章</div>
                </div>
            </div>
        </div>
        <div class="column col-4 col-sm-12">
            <div class="-info-viewer">
                <div class="text-center">
                    <div class="big-val text-error"><?php echo categoryCount(); ?></div>
                    <div class=" desc">分类</div>
                </div>
            </div>
        </div>
        <div class="column col-4 col-sm-12">
            <div class="-info-viewer">
                <div class="text-center">
                    <div class="big-val text-error"><?php echo tagCount(); ?></div>
                    <div class=" desc">标签</div>
                </div>
            </div>
        </div>
    </div>

    <!-- cate-list -->
    <?php while ($cate->next()): ?>
        <?php if ($cate->mid == $mid): ?>
            <?php $isCurrent = 'active'; ?>
        <?php else: ?>
            <?php $isCurrent = ''; ?>
        <?php endif; ?>
        <?php if ($cate->count > 0): ?>
            <div
                data-mid="<?php echo ($cate->mid); ?>,<?php echo ($mid); ?>"
                class="cate-item <?php echo ($isCurrent); ?>"
                onclick="location.href='<?php $cate->permalink(); ?>';">
                <div class="hide-sm f1 m-2 text-ellipsis">
                    <div class="text-bold d-flex a-center">
                        <span class="mr-1"><?php $cate->name(); ?></span>
                        <span class="chip bg-warning text-white">
                            <?php $cate->count(); ?>
                        </span>
                    </div>
                    <div class="text-gray text-tiny hide-sm"><?php $cate->description(); ?></div>
                </div>
                <div class="text-center">
                    <div class="-icon -category m-auto"></div>
                    <div class="show-sm">
                        <span><?php $cate->name(); ?></span>
                    </div>
                </div>
            </div>
        <?php else: ?>
            <div
                data-mid="<?php echo ($cate->mid); ?>,<?php echo ($mid); ?>"
                class="-disabled cate-item <?php echo ($isCurrent); ?>">
                <div class="hide-sm f1 m-2 text-ellipsis">
                    <div class="d-flex a-center">
                        <span class="mr-1"><?php $cate->name(); ?></span>
                    </div>
                    <div class="text-gray hide-sm text-tiny">空栏目</div>
                </div>
                <div class="text-center">
                    <div class="-icon -category m-auto"></div>
                    <div class="show-sm">
                        <span><?php $cate->name(); ?></span>
                        <div class="text-gray text-tiny" style="font-size:9px;">空栏目</div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    <?php endwhile; ?>

    <div class="d-none"><?php $this->options->feedUrl(); ?></div>
</div>